#include"threadPool.hpp"
#include"Task.hpp"
#include<stdlib.h>
#include"log.hpp"
int main()
{
    srand((unsigned long)time(nullptr)^getpid());
    ThreadPool<Task> * tp=new ThreadPool<Task>();
    tp->run();
    while(true)
    {
        //生产任务，制作任务要花时间
        int x=rand()%100+1;
        int y=rand()%30+1; 
        usleep(7721);
        Task t(x,y,[](int x,int y)->int{
            return x+y;
        });
        // std::cout<<"那我问你："<<x<<"+"<<y<<"=?"<<std::endl;
        logMessage(DEBUG,"那我问你:%d+%d=?\n",x,y);
        //推送任务到线程池中
        tp->pushTask(t); 
        sleep(1);
    }
   
    return 0;
}